package com.geologyoa.commons;

public class commUtils {

	/**
	 * 根据lenth 前补0，使str到指定位数
	 * @param str
	 * @param length
	 * @return
	 */
	public static String completStr(String str, int length) {
		StringBuffer sb = new StringBuffer();
		//str不为空时，补0处理
		if (str != null && !str.equals("")) {
			sb.append(str);
			while (sb.length() < length) {
				sb.insert(0, "0");
			}
		}
		return sb.toString();
	}
	public static String parseForCjdwType(String type){
		String name = "勘查";
		if(type.equals("A")||type.equals("KC")){
			name = "勘查";
		}else if(type.equals("B")||type.equals("KY")){
			name = "可研";
		}else if(type.equals("C")||type.equals("SJ")){
			name = "设计";
		}else if(type.equals("D")||type.equals("SG")){
			name = "施工";
		}else if(type.equals("E")||type.equals("JL")){
			name = "监理";
		}else if(type.equals("F")||type.equals("JC")){
			name = "监测";
		}
		return name;
	}
	public static String parseForCjdwName(String name ){
		String type="A";
		if(name.equals("勘查")){
			type = "A";
		}else if(name.equals("可研")){
			type = "B";
		}else if(name.equals("设计")){
			type = "C";
		}else if(name.equals("施工")){
			type = "D";
		}else if(name.equals("监理")){
			type = "E";
		}else if(name.equals("监测")){
			type = "F";
		}
		return type;
	}
	public static String parseForCjdwTypeByName(String name){
		String type = "KY";
		if(name.equals("勘查")){
			type = "KC";
		}else if(name.equals("可研")){
			type = "KY";
		}else if(name.equals("设计")){
			type = "SJ";
		}else if(name.equals("施工")){
			type = "SG";
		}else if(name.equals("监理")){
			type = "JL";
		}else if(name.equals("监测")){
			type = "JC";
		}
		return type;
	}
	public static String parseForZjpfTypeCode(String type){
		String zjpfType="00";
		if(type.equals("A")){
			zjpfType = "01";
		}else if(type.equals("B")){
			zjpfType = "02";
		}else if(type.equals("C")){
			zjpfType = "03";
		}else if(type.equals("D")){
			zjpfType = "04";
		}else if(type.equals("E")){
			zjpfType = "05";
		}
		return zjpfType;
	}
	public static String parseForZjpfNameByCode(String type){
		String zjpfName="中央特大型补助";
		if(type.equals("A")){
			zjpfName = "中央特大型补助";
		}else if(type.equals("B")){
			zjpfName = "中央切块资金";
		}else if(type.equals("C")){
			zjpfName = "省级财政";
		}else if(type.equals("D")){
			zjpfName = "地方配套";
		}else if(type.equals("E")){
			zjpfName = "其他资金";
		}
		return zjpfName;
	}
	public static String parseForZjpfCodeByName(String name){
		String type="A";
		if(name.equals("中央特大型补助")){
			type = "A";
		}else if(name.equals("中央切块资金")){
			type = "B";
		}else if(name.equals("省级财政")){
			type = "C";
		}else if(name.equals("地方配套")){
			type = "D";
		}else if(name.equals("其他资金")){
			type = "E";
		}
		return type;
	}
}
